﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;


namespace Kamikaze
{
    class Historia : SceneBase
    {
        Texture2D historia;

        MouseState mouse, oldMouse;
        AnimatedObject botaoVoltar;

        


        public override void start()
        {

            Game1.Self.IsMouseVisible = true;
            historia = (Game1.Self.Content.Load<Texture2D>(@"Imagens/historia"));

            Kamikaze.AnimatedObject.AnimationStructure animationVoltar = new Kamikaze.AnimatedObject.AnimationStructure();
            animationVoltar.frameCount = 1;
            animationVoltar.frameWidth = 135;
            animationVoltar.frameHeight = 37;
            animationVoltar.framePerSecond = 1;
            animationVoltar.X = 135;
            animationVoltar.Y = 0;


            botaoVoltar = new AnimatedObject(Game1.Self.Content.Load<Texture2D>(@"Imagens/voltar"), 135, 36);
            botaoVoltar.posicao.Y = 350;
            botaoVoltar.posicao.X = 500;
            botaoVoltar.listaAnimations.Add("voltar", animationVoltar);


        }

        public override void update(GameTime gameTime)
        {
            oldMouse = mouse;
            mouse = Mouse.GetState();


            botaoVoltar.calcularRetangulo();
            botaoVoltar.Update(gameTime);


            if (botaoVoltar.collisionBounds.Contains(mouse.X, mouse.Y))
            {


                botaoVoltar.ChangeAnimation("voltar");



            }
            else
            {


                botaoVoltar.ChangeAnimation("default");
            }


            
            if (mouse.LeftButton == ButtonState.Pressed && oldMouse != mouse)
            {
                if (botaoVoltar.collisionBounds.Contains(mouse.X, mouse.Y))
                {
                    SceneManager.setScene(new Menu());
                }
            }


        }

        


        public override void draw(SpriteBatch spriteBatch)
        {



            spriteBatch.Draw(historia, new Vector2(0, 0), Color.White);
            botaoVoltar.Draw(spriteBatch);
        }

        public override void terminate()
        {
            
        }








    }
}
